<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ include file="header.jsp" %>
    <h1>写博客</h1>

    <form action="${pageContext.request.contextPath}/blog/save" method="post" style="max-width: 800px; margin: 30px auto;">
        <c:if test="${not empty blog.id}">
            <input type="hidden" name="id" value="${blog.id}">
        </c:if>

        <div style="margin-bottom: 15px;">
            <label for="title">标题:</label>
            <input type="text" id="title" name="title" value="${blog.title}" required style="width: 100%; padding: 8px; margin-top: 5px;">
        </div>

        <div style="margin-bottom: 15px;">
            <label for="content">内容:</label>
            <textarea id="content" name="content" required style="width: 100%; padding: 8px; margin-top: 5px; height: 300px;">${blog.content}</textarea>
        </div>

        <button type="submit" class="btn">发布</button>

        <c:if test="${not empty error}">
            <p class="error" style="margin-top: 10px;">${error}</p>
        </c:if>
    </form>
<%@ include file="footer.jsp" %>